package top.luoyuanxiang.mqtt.controller;

import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.luoyuanxiang.mqtt.handler.MqttSendHandler;

/**
 * mqtt控制
 *
 * @author luoyuanxiang
 */
@RestController
@RequestMapping("/mqtt")
public class MqttController {

    @Resource
    private MqttSendHandler mqttSendHandler;

    @GetMapping("/send")
    public String sendMessage() {
        mqttSendHandler.sendToMqtt("Hello, MQTT!", "example/topic");
        return "Message sent.";
    }
}
